import java.util.ArrayList;
import java.util.Arrays;

public class test {
    //原地移除数组中所有的元素val
    /* public static int removeElement(int[] nums, int val) {
        int size = nums.length;
        for (int i = 0; i < nums.length; i++) {
            if(nums[i] == val){
                for (int j = i; j < size - 1; j++) {
                    nums[j] = nums[j+1];
                }
                nums[size - 1] = -1;
                size--;
                i--;
            }
        }
        return size;

    }

    public static void main(String[] args) {
        int[] nums = {4,4,0,1,0,2};
        System.out.println(removeElement(nums, 0));
    } */

    //删除排序数组中的有序项
   /*  public static int removeDuplicates(int[] nums) {
        int ret = 0;
        for (int i = 0; i < nums.length; i++) {
            if(nums[i] != nums[ret]){
                nums[++ret] = nums[i];
            }
        }
        return ret + 1;
    }

    public static void main(String[] args) {
        int[] nums = {1,1,1,2};
        System.out.println(removeDuplicates(nums));
        System.out.println(Arrays.toString(nums));
    } */
}
